package com.yonyou.cyxdms.sysAuth.service.controller.cms;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.yonyou.cyx.framework.controller.base.BaseController;
import com.yonyou.cyx.framework.util.bean.ApplicationContextHelper;
import com.yonyou.cyx.function.exception.ServiceBizException;
import com.yonyou.cyx.function.utils.common.CommonUtils;
import com.yonyou.cyx.function.utils.common.StringUtils;
import com.yonyou.cyxdms.framework.bean.dto.user_info.LoginInfoDto;
import com.yonyou.cyxdms.sysAuth.service.constants.CommonConstants;
import com.yonyou.cyxdms.sysAuth.service.constants.ManageDictCodeConstants;
import com.yonyou.cyxdms.sysAuth.service.dto.CodeDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.CommonTreeDTO;
import com.yonyou.cyxdms.sysAuth.service.dto.role.RolePDto;
import com.yonyou.cyxdms.sysAuth.service.entity.cms.UserInfoInterFaceDTO;
import com.yonyou.cyxdms.sysAuth.service.entity.cms.UserInfoInterFaceVO;
import com.yonyou.cyxdms.sysAuth.service.entity.cms.UserInfoInterZhiHuiVO;
import com.yonyou.cyxdms.sysAuth.service.entity.role.RolePO;
import com.yonyou.cyxdms.sysAuth.service.service.cms.CMSRoleService;
import com.yonyou.cyxdms.sysAuth.service.service.manage.employee.EmployeeService;
import com.yonyou.cyxdms.sysAuth.service.service.permission.PermissionCtrlService;
import com.yonyou.cyxdms.sysAuth.service.service.role.RoleCtrlService;
import com.yonyou.cyxdms.sysAuth.service.service.role.RoleMenuActionService;
import com.yonyou.cyxdms.sysAuth.service.service.role.RoleMenuRangeService;
import com.yonyou.cyxdms.sysAuth.service.service.role.RoleService;
import com.yonyou.cyxdms.sysAuth.service.vo.role.RolePageVO;
import com.yonyou.cyxdms.sysmanage.client.vo.role.UserbyRoleVO;
import io.swagger.annotations.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.MultiValueMap;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 角色管理
 *
 * @author adu
 * @since 2019/9/23
 */
@Api(value = "角色管理", tags = {"角色管理"})
@RestController
@RequestMapping("/cmsbasedata/roles")
public class CMSRoleMangeController extends BaseController {


    // 定义日志接口
    private static final Logger logger = LoggerFactory.getLogger(com.yonyou.cyxdms.sysAuth.service.controller.manage.role.RoleMangeController.class);

    @Autowired
    private CMSRoleService roleService;


    /**
     * 查询经销商员工信息
     *
     * @author 张覃
     * @since 2019/9/18
     */
    @ResponseBody
    @PostMapping(value = "/getUserInfo")
    @ApiOperation(value = "查询经销商员工信息")
    public UserInfoInterFaceVO getUserInfo(@RequestBody UserInfoInterFaceDTO userInfoInterFaceDTO ) {
        return roleService.getUserInfo(userInfoInterFaceDTO);
    }

    /**
    * @Description:  查询经销商和厂端员工信息
    * @Param:
    * @return:
    * @Author: wangsht
    * @Date: 2021/3/8
    */
    @ResponseBody
    @PostMapping(value = "/getUserInfoAll")
    @ApiOperation(value = "查询经销商和厂端员工信息")
    public UserInfoInterZhiHuiVO getUserInfoAll(@RequestBody UserInfoInterFaceDTO userInfoInterFaceDTO ) {
        return roleService.getUserInfoAll(userInfoInterFaceDTO);
    }


    /**
     * 定时任务更新-汽车行业时长（年）
     *
     * @author 张覃
     * @since 2019/9/18
     */
    @GetMapping(value = "/updateAutoTime")
    public void updateAutoTime() {
        roleService.updateAutoTime();
    }


}
